package com.neusoft.demo.controller;


import com.neusoft.demo.pojo.Cart;
import com.neusoft.demo.pojo.Foods;
import com.neusoft.demo.pojo.Orders;
import com.neusoft.demo.server.OrderServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@CrossOrigin
@Controller
@RequestMapping("orders")
public class OrdersController {
    @Autowired
    OrderServer orderServer;
    @ResponseBody
    @RequestMapping("list")
    public java.util.List<Orders> businessList(int userId){
        return orderServer.ordersList(userId);
    }
    @ResponseBody
    @PostMapping("/add")
    public boolean addOrders(Orders orders){
        return orderServer.addOrders(orders);
    }
    @ResponseBody
    @PostMapping("/del")
    public boolean delOrders(int foodId){
        return orderServer.delOrders(foodId);
    }
    @ResponseBody
    @RequestMapping("/delS")
    public  boolean del(Orders orders){

        return orderServer.del(orders);
    }
    @ResponseBody
    @PostMapping("/up")
    public boolean up(Orders orders){
        return orderServer.updateOr(orders);
    }
    @ResponseBody
    @RequestMapping("/ups")
    public boolean upS(Orders orders){
        return orderServer.upOr(orders);
    }
}
